package glossos.tree;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;

public class MatchPatternPredicateTestCase {

	MatchPatternPredicate predicate;
	
	@Test
	public void shouldApplyForEqualLiterals() {
		predicate = new MatchPatternPredicate("Darkness is cheap");
		assertTrue(predicate.apply("darkness is cheap"));
	}
	
	@Test
	public void shouldNotApplyForDifferentLengths() throws Exception {
		predicate = new MatchPatternPredicate("Darkness is cheap");
		assertFalse(predicate.apply("darkness is"));		
		assertFalse(predicate.apply("darkness is cheap enough"));		
	}

	@Test
	public void shouldApplyForVariables() throws Exception {
		predicate = new MatchPatternPredicate("Darkness $ cheap");
		assertTrue(predicate.apply("Darkness is cheap"));
	}
	
}
